import type { IQuery, IResponse, TableResponse } from '@/api/config/types';
import axios from 'axios';

export interface ResolutionModel {
  id?: number;
  color: string;
  scale: number;
  dpi: number;
  flip: number;
  description: string;
  resolutionId: string;
  width: number;
  height: number;
  createTime: string;
  updateTime: string;
}

export const modelList = (query: IQuery) =>
  axios.get<TableResponse<ResolutionModel>>(`/resolution/type/list`, {
    params: query,
  });
export const queryModel = () => axios.get<IResponse<ResolutionModel[]>>(`/resolution/type/query`);

export const modelDetail = (id: number | string) =>
  axios.get<IResponse<ResolutionModel>>(`/resolution/type/${id}`);

export const updateModel = (data: ResolutionModel) =>
  axios.put<IResponse>(`/resolution/type`, data);
export const createModel = (data: ResolutionModel) =>
  axios.post<IResponse>(`/resolution/type`, data);
export const delModel = (ids: (number | string)[]) =>
  axios.post<IResponse>(`/resolution/type/${ids.join(',')}}`);
